package com.lun.swordtowardoffer2.c08;

import com.lun.util.BinaryTree.TreeNode;

public class PruneTree {
	
	public TreeNode pruneTree(TreeNode node) {
		if(node == null) {
			return null;
		}
		
		node.left = pruneTree(node.left);
		node.right = pruneTree(node.right);
		
		if(node.left == null && node.right == null && node.val == 0) {
			return null;
		}
		
		return node;
	}

}
